const arr = [1, 2, 1, 3]
function finValue(array) {
    const map = new Map();
    const res = []
    for (let item of array) {
        if (!map.has(item)) {
            map.set(item, 1)
        } else {
            console.log(map.get(item)+1);
            // map[item] += 1
            map.set(item, map.get(item)+1)
        }
    }
    for (let key of map) {
        console.log(key,map.get(key) );
        if (map.get(key) == 1) {
            res.push(key)
        }
    }
    console.log(map.values());
    console.log(res);
    return res
}
finValue(arr)